<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('库存修改单')" />
	
	<style>
		.preservationBtn{padding: 10px;text-align: center;}
		.preservationBtn input{font-size: 16px;background-color: rgb(80, 138, 238);color: #fff;border: none;padding: 5px 30px;border-radius: 10px;cursor: pointer;}
	</style>
	<style>
		.layui-layer-content{margin: 0;}
		.xgtc .layui-form-item{margin: 6px;}
		.xgtc .layui-form-label{width: 100px !important;}
		.xgtc .layui-input-block{margin-left:100px;}
		.xgtc .layui-textarea{height: 100px;}
		.imgwidth{width: 130px !important;height: 130px !important;display: flex;align-items: center;justify-content: center;margin-bottom: 10px;}
		.fieldsimg{margin-bottom: 10px;}
		.fieldsimg .layui-icon{position: relative !important;right: 0;top: -10px;width: 100%;}
		.fieldsimg{padding: 0 !important;width: 140px;height: 130px;display: flex;align-items: center;justify-content: center;}
		.layui-card-header .layui-form-item{display:flex;flex-wrap: wrap;}
		#uploadDemoView img{width: 140px !important;height: 130px !important;}
		/* .xgtc .layui-form select{display: block !important;} */

	</style>

    <style>
        .layui-tab-title{border-color: #ccc !important;}
        .layui-this{color: rgb(0, 135, 250) !important;background: none !important;}
        .layui-tab-brief > .layui-tab-title .layui-this:after, .layui-tab-brief > .layui-tab-more li.layui-this:after{border-color:  rgb(0, 135, 250) !important;}
        .mid-content {overflow: auto;}
    </style>
    
	<link href="/dhecp/css/dh-business.css?v=25" rel="stylesheet">

    <!-- layui-->
    <script src="/plugins/layui/2.7.6/layui.js" charset="utf-8"></script>
	
	<script src="/js/jquery/jquery.min.js"></script>
	<script src="/js/jquery/jquery.cookie.js"></script>
	<script src="/js/jquery/jquery.blockUI.min.js"></script>
	<script src="/dhecp/js/dh-common.js?v=54"></script>
	<script src="/dhecp/js/dh-ui.js?v=36"></script>
	<script src="/dhecp/js/dh-motif-list.js?v=1"></script>
	<script src="/js/jquery/jquery.validate.min.js"></script>
	<script src="/js/jquery/jquery.validate.extend.js"></script>
	
	<script src="/dhecp/js/dh-business.js?v=1"></script>
	<script src="/dhecp/js/selectInTable.js?v=1"></script>
	<script src="/js/plugins/gridreport/grwebapp.js?v=7"></script>
	<script src="/js/plugins/xlsxFull/xlsx.full.min.js?v=1"></script>

</head>

<body class="no-skin">
<div class="main-container" id="main-container">
	
	<div class="layui-tab layui-tab-brief" style="background-color: #fff;">
		<ul class="layui-tab-title">
			<li class="layui-this">入库</li>
			<li>出库</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<form class="layui-form head-form">
				    <div class="north" style="background-color: #fff;">
						<div class="forminput">
							<div class="layui-form layui-card-header layuiadmin-card-header-auto">
								<div class="layui-form-item margin_t0">
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>库存修改单号：</font></label>
										<div class="layui-input-block">
											<input type="text" name="bid" id="bid" th:value="${StockOpe.bid}" class="layui-input canntEdit" lay-verify="" autocomplete="off" onblur="" readonly="">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font class="f_red">*</font><font>公司编码：</font></label>
										<div class="layui-input-block">
											<input type="text" class="layui-input buttontext" name="vGsBm" id="vGsBm" value="" autocomplete="off" readonly="" onblur="inputOnBlur(this)" style="border: 1px solid red;"><i class="layui-icon layui-icon-more getMore" onclick="getMore('vGsBm',null,'公司编码',null,false,false)" gettype="vGsBm"></i>
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>公司简称：</font></label>
										<div class="layui-input-block">
											<input type="text" name="vGsJc" id="vGsJc" value="" class="layui-input canntEdit" lay-verify="" autocomplete="off" onblur="" readonly="">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>公司名称：</font></label>
										<div class="layui-input-block">
											<input type="text" name="vGsMc" id="vGsMc" value="" class="layui-input canntEdit" lay-verify="" autocomplete="off" onblur="" readonly="">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font class="f_red">*</font><font>产品编码：</font></label>
										<div class="layui-input-block">
											<input type="text" name="productCode" id="productCode" value="" class="layui-input" lay-verify="required" autocomplete="off" onblur="inputOnBlur(this)">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>产品名称：</font></label>
										<div class="layui-input-block">
											<input type="text" name="productName" id="productName" value="" class="layui-input canntEdit" lay-verify="" autocomplete="off" onblur="" readonly="">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font class="f_red">*</font><font>操作数量：</font></label>
										<div class="layui-input-block">
											<input type="text" name="productNum" id="productNum" value="" class="layui-input" lay-verify="required" autocomplete="off" onblur="inputOnBlur(this)">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>备注说明：</font></label>
										<div class="layui-input-block">
											<input type="text" name="remark" id="remark" value="" class="layui-input" lay-verify="" autocomplete="off" onblur="">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>货位：</font></label>
										<div class="layui-input-block">
											<input type="text" class="layui-input buttontext" name="locationHw" id="locationHw" value="" autocomplete="off" readonly="" onblur=""><i class="layui-icon layui-icon-more getMore" onclick="getMore('locationHw',null,'货位','tcc_goodsallocation',false,false)" gettype="locationHw"></i>
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>库区：</font></label>
										<div class="layui-input-block">
											<input type="text" name="locationKq" id="locationKq" value="" class="layui-input canntEdit" lay-verify="" autocomplete="off" onblur="" readonly="">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>所在仓库：</font></label>
										<div class="layui-input-block">
											<input type="text" name="locationArea" id="locationArea" value="" class="layui-input canntEdit" lay-verify="" autocomplete="off" onblur="" readonly="">
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-form-item preservationBtn">
							<input type="button" lay-submit lay-filter="btn-add" id="btn-add" value="保存">
						</div>
			    	</div>
			    </form>
			</div>
			<div class="layui-tab-item">
				<form class="layui-form head-form">
				    <div class="north" style="background-color: #fff;">
						<div class="forminput">
							<div class="layui-form layui-card-header layuiadmin-card-header-auto">
								<div class="layui-form-item margin_t0">
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>库存修改单号：</font></label>
										<div class="layui-input-block">
											<input type="text" name="bid" id="bid" th:value="${StockOpe.bid}" class="layui-input canntEdit" lay-verify="" autocomplete="off" onblur="" readonly="">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font class="f_red">*</font><font>库存GUID：</font></label>
										<div class="layui-input-block">
											<input type="text" name="guidStockControl" id="guidStockControl" value="" class="layui-input" lay-verify="required" autocomplete="off" onblur="inputOnBlur(this)">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font class="f_red">*</font><font>操作数量：</font></label>
										<div class="layui-input-block">
											<input type="text" name="productNum" id="productNum" value="" class="layui-input" lay-verify="required" autocomplete="off" onblur="inputOnBlur(this)">
										</div>
									</div>
									<div class="layui-inline margin_r0 layui-col-xs4">
										<label class="layui-form-label"><font>备注说明：</font></label>
										<div class="layui-input-block">
											<input type="text" name="remark" id="remark" value="" class="layui-input" lay-verify="" autocomplete="off" onblur="">
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-form-item preservationBtn">
							<input type="button" lay-submit lay-filter="btn-add-out" id="btn-add-out" value="保存">
						</div>
			    	</div>
			    </form>
			</div>
		</div>
	</div>
</div>

<!-- 入库的JS控制 -->
<script th:inline="javascript">
var	k_fields=[];
var fields = [[${fields}]];
var fieldsList = [[${fieldsList}]];
var fieldsHiddenList = [[${fieldsHiddenList}]];
var gridColumns= [[${gridColumns}]];
var all_fields= fieldsList;

layui.use(['form', 'element', 'table', 'dropdown', 'util', 'laydate'], function(){
	var element = layui.element;
	var table = layui.table;
	var dropdown = layui.dropdown;
	var form = layui.form;
	var util = layui.util;
	var $ = layui.jquery;
	var laydate = layui.laydate;

	form.on('submit(btn-add)', function(data){
		console.log(data.field);
		var is_return = false//是否中断保存
		fieldsList.map((v,i)=>{
			if(v.fieldFrontRequired){
				if(!$('#'+v.fields).val()){
					layer.msg(v.fieldName+'不能为空')
					is_return=true
				}
			}
		})
		if(is_return) return;
		
		$.post("/storage/stockope/addpostIn", data.field, function(res){
			if(res.code==0){
				layer.confirm('操作成功，请选择是否继续操作', {
					btn: ['继续添加','不继续'] //按钮
				}, function(){
					window.location.reload();
				}, function(){
				});
			} else {
				layer.msg(res.msg);
			}
		});
		return false;
   });
	
});
</script>

<!-- 出库的JS控制 -->
<script th:inline="javascript">

layui.use(['form', 'element', 'table', 'dropdown', 'util', 'laydate'], function(){
	var element = layui.element;
	var table = layui.table;
	var dropdown = layui.dropdown;
	var form = layui.form;
	var util = layui.util;
	var $ = layui.jquery;
	var laydate = layui.laydate;

	form.on('submit(btn-add-out)', function(data){
		console.log(data.field);
		$.post("/storage/stockope/addpostOut", data.field, function(res){
			if(res.code==0){
				layer.confirm('操作成功，请选择是否继续操作', {
					btn: ['继续添加','不继续'] //按钮
				}, function(){
					window.location.reload();
				}, function(){
				});
			} else {
				layer.msg(res.msg);
			}
		});
		return false;
   });
	
});
</script>

</body>
</html>